
  <template>
  <el-input placeholder="请输入专业" v-model="Into.searchName" clearable> </el-input>
  <el-button type="primary" @click="select">查找</el-button>

 
    <el-table :data="list" border stripe>
        <el-table-column type="index" label="#"></el-table-column>
        <el-table-column label="学号" prop="Sno">   </el-table-column>
        <el-table-column label="姓名" prop="Sname"></el-table-column>
        <el-table-column label="年龄" prop="Sage"></el-table-column>
        <el-table-column label="性别" prop="Ssex"></el-table-column>
        <el-table-column label="专业" prop="Sdept"></el-table-column>
        <el-table-column label="地区" prop="Sregion"></el-table-column>
        <el-table-column label="学制" prop="Sedu_sys"></el-table-column>
        <el-table-column label="政治面貌" prop="Spolitics"></el-table-column>
        <el-table-column label="民族" prop="Snation"></el-table-column>
    </el-table>
     <el-input placeholder="请输入课程号" v-model="Addform.cno" clearable> </el-input>
     <el-input placeholder="请输入学生学号" v-model="Addform.sno" clearable></el-input>
     <el-input placeholder="请输入该学生本门课成绩" v-model="Addform.grade" clearable></el-input>
     <el-button type="primary" @click="add">录入</el-button>

</template>

  <script>
  import { ElMessage } from "element-plus";
export default {
  data() {
    return {
        list:[],
      Addform: {
        cno:"",
        sno: "",
        grade: "",
      },
      Into:{
        searchName:"",
        limit :2,
        page:1
      }
    };
  },
  methods: {
    async select() {
      const { data: res} = await this.$http.get("/system/apis/student",{ params: this.Into});
      this.list = res.data.value
      console.log(this.list)
    },

    async add(){
      const {
        data:res1
      } = await this.$http.post("/system/apis/sc",this.Addfrom);
      console.log(res1);
      if(res1.code==20000)
      {
        ElMessage.success({
            message: '录入成功',
            type: 'success'
          });
      }else{
        ElMessage.warning({
            message: '录入失败',
            type: 'warning'
          });
      }
    }
  },
  
}
</script>
